<?php
require('database.php');

$name = $_POST['Swimmer'];
$gender = $_POST['Gender'];

if ($gender=="Male")
	$g=1;
else
	$g=0;


//$query = "INSERT INTO swimmer (name,gender) VALUES ('".$name."','".$gender."')";

//mysql_query($query) or die;

//include 'closedb.php';
echo "Wellcome " . $name . " !";
echo "<br>";
echo "Your gender is ".$gender."<br /> ";

//Try to input data to database
$link=open_connection();
$sqlstr="insert into swimmer(name,gender) values ('" . $name . "','" . $g . "')";
echo "<br>";
echo $sqlstr;
$result = mysql_query ($sqlstr) or die ("Kesalahan pada perintah SQL!");
$cek=mysql_num_rows($result);
mysql_close($link);
?>
